
package biblio.dao;


import biblio.domain.Category;
import biblio.exception.NoSuchEntityException;
import java.io.Serializable;
import java.util.List;


/**
 * Interface for persistance of Category.
 * 
 * @author mephisto
 */
public interface CategoryDAO
{
/**
     * Persists category given as a parameter in the database.
     *
     * @param category the category to set, this entity will be persited in the database
     */
    void create(Category category);

    /**
     * Returns found category indentified by id in the database or throws
     * NoSuchUserException if such category does not exist.
     *
     * @param categoryName the categoryName to set
     * @return Category which is identfied by id
     * @throws NoSuchUserException NoSuchEntityException if no Category is
     *         associated with this categoryName
     * @throws IllegalStateException if categories are duplicated, it won't happened if
     *         databse structure has unique key on column name
     */
    Category find(Serializable categoryName) throws NoSuchEntityException;

    /**
     * Returns the list of all categories stored in the database. List is empty
     * when no entity is stored in the database.
     *
     * @return the list of all categories stored in the database
     */
    List<Category> selectAll();

    /**
     * Updates found category in the database or throws
     * NoSuchEntityException if such category does not exist.
     *
     * @param category to set the category which will be updated
     * @throws NoSuchUserException if no User is associated with this id
     */
    void update(Category category) throws NoSuchEntityException;

    /**
     * Deletes category from the database if only exists.
     *
     * @param category to set the category which will be deleted
     */
    void delete(Category category);
}
